<!doctype html>
<html lang="">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite App</title>
    <style></style>
  </head>
  <body>
    <div class="father">
      点father
      <div class="son">
        点son
        <h2>标题</h2>
      </div>
    </div>
    <script>
      const father = document.querySelector('.father')
      father.addEventListener('click', (e) => {
        alert('father')
      })

      const son = document.querySelector('.son')
      son.addEventListener('click', (e) => {
        alert('son')
      })
      const h2 = document.querySelector('h2')
      h2.addEventListener('click', (e) => {
        // 阻止冒泡事件
        e.stopPropagation()
        alert('h2')
      })
    </script>
  </body>
</html>
